<%@ page language="java" import="java.util.*" pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> 
 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
 <%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head> 
    <link rel="stylesheet" href="<s:url value="/resources"/>/css/common.css" type="text/css" />   
    <link rel="stylesheet" href="<s:url value="/resources"/>/css/innerstyle.css" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/cupertino/jquery-ui.custom.min.css" />
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-ui.custom.min.js"></script> 
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.form.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/json2.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.validate.min.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/messages_zh.js"></script>
<style type="text/css">
	label.error {  
	        color: red;/*错误信息的颜色*/  
	    }  
	input.error {  
	        border:1px dotted red;/*输入错误的输入框的边框样式*/  
	    }	
</style>
<script type='text/javascript'>
	$(function(){ 
	    $("#but1").button();
	    $("#but2").button(); 
	    $("#but3").button(); 
	    jiaoyan();
     });
     
	//加载市信息
    function changForCity(value){ 
         $.getJSON("<s:url value="/cxtj"/>/changForCity", {province:value}, function(data){
                 //console.log(data[0]);
                 // var ret = eval('(' + data[0] + ')'); 
                 //console.log(ret);
                 //alert(data[1].regionname); 
                  $("#city").empty();
                  $("#city").append("<option value='-1' selected>==请选择==</option>");
		          for(var i=0;i<data.length;i++){
			        sObj = data[i];
			        $("#city").append("<option value='"+sObj.regioncode+"'>"+sObj.regionname+"</option>");
		           } 
          }); 
       }
	
	//校验
	function jiaoyan()
	{
		   
		 $.validator.addMethod("selectNone", 
			        function(value, element)
			        {   
			            if (value == "-1") 
			            {    
			                return false;    
			            }    
			            else    
			            {   
			                return true;    
			            }   
			        },    
			        "必须选择一项" 
			        ); 
	         $("#form1").validate({
			       rules: {
			    	   "maisdwmc":"required",
			    	   "maisdwdz":"required", 
			    	   "maisdwfddbr":"required", 
			    	   "maisdwwtdlr":"required", 
			    	   "maisdwdh":"required", 
			    	   "maisdwcz":"required", 
			    	   "maisdwkhyh":"required", 
			    	   "maisdwyzbm":"required", 
			    	   "maisdwzh":"required", 
			    	   "maisdwnsrdjh":"required",
			    	   "suosdq":{ selectNone:true }
			       },
				   messages: {
					   "maisdwmc":"请输入单位名称",
			    	   "maisdwdz":"请输入单位地址", 
			    	   "maisdwfddbr":"请输入法定代表人", 
			    	   "maisdwwtdlr":"请输入委托代理人", 
			    	   "maisdwdh":"请输入单位电话", 
			    	   "maisdwcz":"请输入单位传真", 
			    	   "maisdwkhyh":"请输入开户银行", 
			    	   "maisdwyzbm":"请输入邮政编码", 
			    	   "maisdwzh":"请输入单位银行账号", 
			    	   "maisdwnsrdjh":"请输入纳税登记号",
			    	   "suosdq":"请选择所属地区"
				   }
			   });
	         $("#but1")
				.click(
						function() {
							if ($("#form1").valid()) {
								
								var flag = true;
					
								if (flag) {
									var url = "<s:url value="/"/>/jydz/updateNewMsr";
									$("#form1").ajaxSubmit({
										url : url,
										type : 'post',
										success : function(data) {
											var json = eval('(' + data + ')');
											if (json.result == 1) {
												alert("修改买受人成功！");
												window.location.href="<s:url value="/jydz"/>/findNewMsr";
											} else {
												alert("修改失败！");
											}
										}
									});
								} else {
									alert(msg);
								}
							}
						}); 
	}
	
	</script>
  </head>
  
 <body>
<div id="best1">
<h2><span>修改买受人</span></h2>
<form name="form1" id="form1">
<input type="hidden"  name="sysid" value="${msrxx.sysid}"/>
<table id="list_search" cellpadding="0" cellspacing="0" border="0">
		<tr>
		    <td>
            	单位名称:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<input type="text" name="maisdwmc" class="longtextbox" value="${msrxx.maisdwmc}"/> 
            </td>
        	<td>
            	单位地址:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	
            	<input type="text" name="maisdwdz" class="longtextbox"  value="${msrxx.maisdwdz}"/> 
            </td>
            <td>
                                       
        </tr>

  		<tr>
		    <td>
            	法定代表人:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<input type="text" name="maisdwfddbr" class="longtextbox"  value="${msrxx.maisdwfddbr}"/> 
            </td>
        	
		    <td>
            	委托代理人:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<input type="text" name="maisdwwtdlr" class="longtextbox"  value="${msrxx.maisdwwtdlr}"/> 
            </td>
        </tr>
       
       <tr>
		    <td>
            	单位电话:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<input type="text" name="maisdwdh" class="longtextbox" value="${msrxx.maisdwdh}"/> 
            </td>
        	
		    <td>
            	单位传真:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<input type="text" name="maisdwcz" class="longtextbox" value="${msrxx.maisdwcz}"/> 
            </td>
        </tr>
        <tr>
		    <td>
            	开户银行:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<input type="text" name="maisdwkhyh" class="longtextbox" value="${msrxx.maisdwkhyh}"/> 
            </td>
        	
		    <td>
            	邮政编码:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<input type="text" name="maisdwyzbm" class="longtextbox" value="${msrxx.maisdwyzbm}"/> 
            </td>
        </tr>
        <tr>
		    <td>
            	银行账号:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<input type="text" name="maisdwzh" class="longtextbox" value="${msrxx.maisdwzh}"/> 
            </td>
        	
		    <td>
            	纳税登记号:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<input type="text" name="maisdwnsrdjh" class="longtextbox" value="${msrxx.maisdwnsrdjh}"/> 
            </td>
        </tr>
         <td class="pr10 search-table-70">
                                        所属省市:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>          	 
        	     <select class="form-textbox" style="width: 93px;" onchange="changForCity(this.value)" >
        	            <option value="-1">==请选择==</option>
						<c:forEach var="province" items="${provincelist}">
							<option value="${province.regioncode}" >${province.regionname}</option>
						</c:forEach>
		           </select>
        	       <select id="city" class="form-textbox" style="width: 93px;" name="suosdq" >
        	            <option value="-1" selected>==请选择==</option>
		            </select>
            </td>
        <tr>
		    <td colspan="6" align="center">	
		      
		            <input id="but1" type="button" value="保存" />&nbsp;&nbsp;&nbsp;
			        <input id="but2" type="reset" value="重置" "/>&nbsp;&nbsp;&nbsp;
			        <input id="but3" type="button" name="" value="返回" onclick="javascript:history.back();"/>
			    
		    </td>
        </tr>
  </table> 
</form>
</div> 
<div id="dialog-confirm" title="是否确认保存？"></div>
  </body>
</html>
